package com.hhkj.study.admin.article.controller;

import com.hhkj.study.admin.article.entity.ArticleCatalog;
import com.hhkj.study.admin.article.model.req.ArticleCatalogReq;
import com.hhkj.study.admin.article.model.res.ArticleCatalogRes;
import com.hhkj.study.admin.article.service.biz.ArticleCatalogBizService;
import com.ruoyi.common.annotation.PermissionPrefix;
import com.ruoyi.common.base.biz.controller.v3.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.valid.VDisable;
import com.ruoyi.common.valid.VEdit;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* ArticleCatalogController
*
* @author SERVER
* @since 2024-09-06
*/
@RestController
@PermissionPrefix("article:articleCatalog")
@RequestMapping("/admin/article/catalog")
public class ArticleCatalogController extends BaseController<ArticleCatalog, ArticleCatalogReq, ArticleCatalogRes, ArticleCatalogBizService> {

    /** 上下架 */
    @PreAuthorize("@ss.hasPermi(this, 'edit')")
    @PutMapping("/publish")
    public AjaxResult updatePublishFlag(@Validated(value = {VDisable.class, VEdit.class}) @RequestBody ArticleCatalogReq req) {
        return toAjax(this.getBizService().updatePublishFlag(req));
    }
}
